{% extends "employee/employee_base.html"%}
{% block currentPath %}
 >> <a href="/employee/orders/">Orders</a> >> Status Manage
{% endblock %}

{% block content %}
   <div id="notice"><font color="blue">{{message}}</font><font>{{error}}</font></div>
  <h2>Order Status Manage</h2>
  <div id="customer-info" class="order-info-div">
    <h4>Delivery Information</h4>
    <p>Username: {{order.iduser.username}}</p>
    <p>Recipient: {{order.idaddress.name}} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Contact: {{order.idaddress.phone}}</p>
    <p>Address: {{order.idaddress.address}}, {{order.idaddress.postnumber}}, {{order.idaddress.city}}, {{order.idaddress.state}}, {{order.idaddress.country}}</p>
  </div>
  <div id="order-basic-info" class="order-info-div">
    <h4>Order basic information</h4>
    <p>Id: {{order.id}} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='#1435AD'><strong>Status: {{order.status.type}}</strong></font></p>
    <p>Created time: {{order.created}}</p>    
    <p>Last change time: {{order.changed}}</p>
  </div>
  <div id="order-product-list" class="order-info-div">
    <h4>Goods list</h4>
    <table cellspacing=0 cellpadding=5 class="table-list" >
        <tr>
            <th>Product Id</th><th> Product name</th><th>Price</th><th>Amount</th><th>Total</th><th>Inventory</th>
        </tr>
        {% for o_detail in order.orderDetails_orders.all%}
        <tr align=center>
            <td width="80px">{{o_detail.idproduct.id}}</td>
            <td width="300px">{{o_detail.idproduct.name}}</td>
            <td>{{o_detail.unit_price}}€</td>
            <td>{{o_detail.count}}</td>
            <td>{% widthratio o_detail.unit_price 1 o_detail.count %}€</td>
            <td>{{o_detail.idproduct.inventory_records.total}}</td>
        </tr>
        {% endfor %}
    </table>
    <br/>
  </div>
  <div id="order-operation" class="order-info-div">
    <form action="" method="post" name="order_operation_form">
      <input type="hidden" id="order_opperation" name="order_opperation" />
      <p>
        {% ifequal order.status.type 'PROCESSED' %}
          <input type="button" value="Shipped" onclick="confirm_order_operation('SHIPPED')"/>
        {% endifequal %}
        {% ifequal order.status.type 'UNPAID' %}
          <input type="button" value="Cancel" onclick="confirm_order_operation('CANCELED')"/>
        {% endifequal %}
      </p>
    </form>
  </div>

  
{% endblock %}